using System.Collections.Generic;
using OpenQA.Selenium;

namespace YatFram.Browser.Selenium
{
    public class SeleniumHtmlElement
    {
        protected readonly IWebElement element;

        public SeleniumHtmlElement(IWebElement element)
        {
            this.element = element;
        }

        public void Click()
        {
            element.Click();
        }

        public string Attribute(string attributeName)
        {
            return element.GetAttribute(attributeName);
        }

        public IEnumerable<string> ClassNames
        {
            get { return element.GetAttribute("class").Split(' '); }
        }

        public object RawElement()
        {
            return element;
        }

        public string Text
        {
            get { return element.Text; }
        }
    }
}